package com.example.myapplication.CustomWidget;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.example.myapplication.R;

public class CustomWidgetActivity extends AppCompatActivity {
    EditText edit_x,edit_y;
    Button btn;
    TestView testView;
    int x1 = 150,y1 = 50;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_custom_widget);

        edit_x = findViewById(R.id.editText1);
        edit_y = findViewById(R.id.editText2);
        testView = findViewById(R.id.testView);

        testView.setXY(x1,y1);

    }

    public void setPosition(View view) {
      x1 = Integer.parseInt(edit_x.getText().toString());
      y1 = Integer.parseInt(edit_y.getText().toString());
      testView.setXY(x1,y1);
      testView.invalidate();
    }
}